package com.weilai.common.service;

import com.weilai.common.dao.PrizeMapper;
import com.weilai.common.model.Prize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Song on 2017/6/4.
 */
@Service
public class PrizeService {
    @Autowired
    PrizeMapper prizeMapper;

    public Integer addPrize(Prize prize) {
       return  prizeMapper.insert(prize);
    }

    public int updatePrize(Prize prize) {
        return prizeMapper.updateByPrimaryKeySelective(prize);
    }

    public int delPrize(Prize prize) {
        return prizeMapper.deleteByPrimaryKey(prize.getId());
    }

    public List<Prize> findPrizeList(Prize prize) {
        List<Prize> prizeList =  prizeMapper.findPrizeList(prize);
       return prizeList;
    }


    public Prize findById(Integer id) {
        Prize prize = prizeMapper.selectByPrimaryKey(id);
        return prize;
    }

    public void updateById(int id) {
        prizeMapper.updateById(id);
    }
}
